package com.example.springstudy.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.example.springstudy.dao.dto.SkuDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
public class Sku extends BaseEntity {
    private String name;
    private String code;
    private BigDecimal price;//售价
    private BigDecimal vipPrice;//会员价
    private BigDecimal buyPrice; //进货价
    private Integer stock; //库存数量
    private String shortName;
    private String img;

    private int type;
    private String unit;
    private int supplierId;
    private Date productDate;

    private int shelfLife; //保质期day

    private Long updateBy;
    private String status;

    private String productNo;

    @TableField(exist = false)
    private String supplierName;

    public Sku(SkuDto dto){
        this.name = dto.getName();
        this.code = dto.getCode();
        this.productNo = dto.getProductNo();
        this.buyPrice = new BigDecimal(dto.getBuyPrice());
        this.unit = dto.getUnit();
    }
}
